import type { App } from 'vue';
import { createRouter, createWebHashHistory } from 'vue-router';
import Index from '/@/views/Index/index.vue';

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      name: 'Index',
      path: '/',
      component: Index,
    },
    {
      path: '/:pathMatch(.*)*',
      redirect: '/', //young 0518
    },
  ],
});
router.beforeEach((to, from) => {
  console.log(to, 'to');
  console.log(from, 'from');

  return true;
});
const setupRouter = async (app: App) => {
  await app.use(router);
};
export { setupRouter, router };
